package com.jy.oms.framework.asyn.task.model;

import com.jy.oms.framework.asyn.task.checker.model.ExecutorCheckResult;
import com.jy.oms.framework.asyn.task.constants.TaskStateEnum;

/**
 * 任务执行结果
 *
 * @author liuquan
 */
public class TaskResultDto {

    /**
     * 任务对象
     */
    private TaskWrapper taskWrapper;

    /**
     * 任务状态
     */
    private TaskStateEnum taskState;

    /**
     * 回调状态
     */
    private TaskStateEnum callbackState;
    
    private int retryNumConfig;

    /**
     * 调用次数
     */
    private int callCount;

    /**
     * 任务耗时
     */
    private long costTime;

    /**
     * 回调方法耗时
     */
    private long callbackCostTime;

    /**
     * 校验器耗时
     */
    private long checkerCostTime;

    /**
     * 任务结果
     */
    private String response;

    /**
     * 是否限速
     */
    private boolean rateLimit;

    /**
     * 是否可重试
     */
    private boolean enableRetry;

    /**
     * 重试间隔时间
     */
    private int retryIntervalSeconds;
    
    private boolean retryBackoff;

    /**
     * 校验过滤
     */
    private boolean checkFilter;

    /**
     * 校验器结果
     */
    private ExecutorCheckResult executorCheckResult;

    /**
     * 异常发生且任务支持重试时，是否允许修改任务参数 便于 下一次执行使用
     */
    private boolean updateTaskParamWhenException;

    /**
     * 任务执行结果
     */
    private Object taskResult;

    /**
     * 异常类型，1业务异常，2系统异常
     */
    private Integer exceptionType;

    private String exceptionTitle;

    public TaskWrapper getTaskWrapper() {
        return taskWrapper;
    }

    public TaskResultDto setTaskWrapper(TaskWrapper taskWrapper) {
        this.taskWrapper = taskWrapper;
        return this;
    }

    public TaskStateEnum getTaskState() {
        return taskState;
    }

    public TaskResultDto setTaskState(TaskStateEnum taskState) {
        this.taskState = taskState;
        return this;
    }

    public int getCallCount() {
        return callCount;
    }

    public TaskResultDto setCallCount(int callCount) {
        this.callCount = callCount;
        return this;
    }

    public long getCostTime() {
        return costTime;
    }

    public TaskResultDto setCostTime(long costTime) {
        this.costTime = costTime;
        return this;
    }

    public String getResponse() {
        return response;
    }

    public TaskResultDto setResponse(String response) {
        this.response = response;
        return this;
    }

    public TaskStateEnum getCallbackState() {
        return callbackState;
    }

    public TaskResultDto setCallbackState(TaskStateEnum callbackState) {
        this.callbackState = callbackState;
        return this;
    }

    public long getCallbackCostTime() {
        return callbackCostTime;
    }

    public TaskResultDto setCallbackCostTime(long callbackCostTime) {
        this.callbackCostTime = callbackCostTime;
        return this;
    }

    public boolean isRateLimit() {
        return rateLimit;
    }

    public TaskResultDto setRateLimit(boolean rateLimit) {
        this.rateLimit = rateLimit;
        return this;
    }

    public long getCheckerCostTime() {
        return checkerCostTime;
    }

    public TaskResultDto setCheckerCostTime(long checkerCostTime) {
        this.checkerCostTime = checkerCostTime;
        return this;
    }

    public boolean isCheckFilter() {
        return checkFilter;
    }

    public TaskResultDto setCheckFilter(boolean checkFilter) {
        this.checkFilter = checkFilter;
        return this;
    }

    public boolean isEnableRetry() {
        return enableRetry;
    }

    public void setEnableRetry(boolean enableRetry) {
        this.enableRetry = enableRetry;
    }

    public int getRetryIntervalSeconds() {
        return retryIntervalSeconds;
    }

    public void setRetryIntervalSeconds(int retryIntervalSeconds) {
        this.retryIntervalSeconds = retryIntervalSeconds;
    }

    public ExecutorCheckResult getExecutorCheckResult() {
        return executorCheckResult;
    }

    public void setExecutorCheckResult(ExecutorCheckResult executorCheckResult) {
        this.executorCheckResult = executorCheckResult;
    }

    public boolean isUpdateTaskParamWhenException() {
        return updateTaskParamWhenException;
    }

    public void setUpdateTaskParamWhenException(boolean updateTaskParamWhenException) {
        this.updateTaskParamWhenException = updateTaskParamWhenException;
    }

    public Object getTaskResult() {
        return taskResult;
    }

    public void setTaskResult(Object taskResult) {
        this.taskResult = taskResult;
    }

    public Integer getExceptionType() {
        return exceptionType;
    }

    public void setExceptionType(Integer exceptionType) {
        this.exceptionType = exceptionType;
    }

    public String getExceptionTitle() {
        return exceptionTitle;
    }

    public void setExceptionTitle(String exceptionTitle) {
        this.exceptionTitle = exceptionTitle;
    }

    public boolean isRetryBackoff() {
        return retryBackoff;
    }

    public void setRetryBackoff(boolean retryBackoff) {
        this.retryBackoff = retryBackoff;
    }

    public int getRetryNumConfig() {
        return retryNumConfig;
    }

    public void setRetryNumConfig(int retryNumConfig) {
        this.retryNumConfig = retryNumConfig;
    }
}
